#include <iostream>
#include <future>
#include <thread>

class AsynchronousInitializer {
public:
    AsynchronousInitializer() {
        // 启动一个后台线程来执行初始化
        std::async(std::launch::async, [&]() {
            // 模拟长时间的初始化过程
            std::this_thread::sleep_for(std::chrono::seconds(2));
            std::cout << "Initialization completed." << std::endl;
        });
    }

    void process() {
        std::cout << "Processing data..." << std::endl;
    }
};

int main() {
    AsynchronousInitializer initializer;
    std::cout << "Main thread is free to continue!" << std::endl;
    initializer.process();
    return 0;
}